// 一.验证码登录验证
// 手机号验证
var oCenterInp1 = document.querySelector("#centerInp1");
var oCenterSp1 = document.querySelector("#centerSp1");

var regCenterInp1 = /^(15|13|18)\d{9}$/;
var flagCenterInp1 = false;
oCenterInp1.onblur = function() {
	if (regCenterInp1.test(oCenterInp1.value)) {
		flagCenterInp1 = true;
		oCenterSp1.innerHTML = "输入正确";
		oCenterSp1.style.fontSize = "13px";
		oCenterSp1.style.color = "greenyellow";
		oCenterInp1.style.border = "1px solid skyblue";
	} else {
		flagCenterInp1 = false;
		oCenterSp1.innerHTML = "您输入的格式错误，请重新输入";
		oCenterSp1.style.fontSize = "13px";
		oCenterSp1.style.color = "red";
		oCenterInp1.style.border = "1px solid red";
	}
}

// 图形验证码验证
var oCenterInp2 = document.querySelector("#centerInp2");
var oCenterSp2 = document.querySelector("#centerSp2");
var oCenterBoxSp3 = document.querySelector(".center-boxSp3");

var flagCenterInp2 = false;
var str = "";
for (var i = 0; i < 4; i++) {
	var x = 0;
	x = Math.round(Math.random() * 35);
	if (x > 9) {
		x = String.fromCharCode(x + 55);
	}
	str += x + "";
}
oCenterBoxSp3.innerHTML = str;

function randomCode() {
	str = "";
	for (var i = 0; i < 4; i++) {
		var x = 0;
		x = Math.round(Math.random() * 35);
		if (x > 9) {
			x = String.fromCharCode(x + 55);
		}
		str += x + "";
	}
	oCenterBoxSp3.innerHTML = str;
}

oCenterInp2.onblur = function() {
	if (oCenterInp2.value == oCenterBoxSp3.innerHTML) {
		flagCenterInp2 = true;
		oCenterSp2.innerHTML = "验证码正确";
		oCenterSp2.style.color = "greenyellow";
		oCenterSp2.style.fontSize = "13px";
		oCenterInp2.style.border = "1px solid skyblue";
	} else {
		flagCenterInp2 = false;
		oCenterSp2.innerHTML = "验证码错误，请重新输入";
		oCenterSp2.style.color = "red";
		oCenterSp2.style.fontSize = "13px";
		oCenterInp2.style.border = "1px solid red";
	}
}

// 手机验证码发送短信
var oCenterInp3 = document.querySelector("#centerInp3");
var oCenterBoxSp4 = document.querySelector(".center-boxSp4");
var oCenterSp3 = document.querySelector("#centerSp3");

var countTime = 60;
oCenterInp3.onclick = function() {
	oCenterInp3.disabled = true;
	//启动定时器
	var timeFlag = setInterval(function() {
		if (countTime > 0) {
			oCenterBoxSp4.innerHTML = countTime + "s";
			countTime--;
			oCenterInp3.style.border = "1px solid skyblue";
		} else {
			clearInterval(timeFlag);
			oCenterInp3.disabled = false;
			oCenterSp3.innerHTML = "请重新发送"
			oCenterSp3.style.fontSize = "13px";
			oCenterSp3.style.color = "red";
			oCenterInp3.style.border = "1px solid red";
		}
	}, 1000);
}

var flagCenterInp3 = false;
oCenterInp3.onblur = function() {
	if (oCenterInp3.value = "") {
		flagCenterInp3 = false;
		oCenterSp3.innerHTML = "请输入手机验证码";
		oCenterSp3.style.fontSize = "13px";
		oCenterSp3.style.color = "red";
		oCenterInp3.style.border = "1px solid red";
	}
}

// 二.密码登录验证
// 手机号验证
var oCenterBox2Inp1 = document.querySelector("#centerBox2Inp1");
var oCenterBox2Sp1 = document.querySelector("#centerBox2Sp1");

var regCenterBox2Inp1 = /^(15|13|18)\d{9}$/;
var flagCenterBox2Inp1 = false;
oCenterBox2Inp1.onblur = function() {
	if (regCenterBox2Inp1.test(oCenterBox2Inp1.value)) {
		flagCenterBox2Inp1 = true;
		oCenterBox2Sp1.innerHTML = "输入正确";
		oCenterBox2Sp1.style.fontSize = "13px";
		oCenterBox2Sp1.style.color = "greenyellow";
		oCenterBox2Inp1.style.border = "1px solid skyblue";
	} else {
		flagCenterBox2Inp1 = false;
		oCenterBox2Sp1.innerHTML = "您输入的格式错误，请重新输入";
		oCenterBox2Sp1.style.fontSize = "13px";
		oCenterBox2Sp1.style.color = "red";
		oCenterBox2Inp1.style.border = "1px solid red";
	}
}

// 账户密码
var oCenterBox2Inp2 = document.querySelector("#centerBox2Inp2");
var oRegisterBoxInp5 = document.querySelector("#registerBoxInp5");
var oCenterBox2Sp2 = document.querySelector("centerBox2Sp2");
var flagCenterBox2Inp2 = false;

oCenterBox2Inp2.onblur = function() {
	if (oCenterBox2Inp2.value.length < 6 || oCenterBox2Inp2.value.length > 18 || oCenterBox2Inp2.value == "" ||
		oCenterBox2Inp2.value != oRegisterBoxInp5.value) {
		flagCenterBox2Inp2 = false;
		oCenterBox2Sp2.innerHTML = "密码错误，请重新输入";
		oCenterBox2Sp2.style.color = "red";
		oCenterBox2Sp2.style.fontSize = "13px";
		oCenterBox2Inp2.style.border = "1px solid red";
	} else {
		flagCenterBox2Inp2 = true;
		oCenterBox2Sp2.innerHTML = "密码输入正确";
		oCenterBox2Sp2.style.color = "greenyellow";
		oCenterBox2Sp2.style.fontSize = "13px";
		oCenterBox2Inp2.style.border = "1px solid skyblue";
	}
}

// 重置密码的验证
// 手机号验证
var oFgCenterBoxInp1 = document.querySelector("#fgCenterBoxInp1");
var oFgCenterBoxSp1 = document.querySelector("#fgCenterBoxSp1");

var regFgCenterBoxInp1 = /^(15|13|18)\d{9}$/;
var flagFgCenterBoxInp1 = false;
oFgCenterBoxInp1.onblur = function() {
	if (regFgCenterBoxInp1.test(oFgCenterBoxInp1.value)) {
		flagFgCenterBoxInp1 = true;
		oFgCenterBoxSp1.innerHTML = "输入正确";
		oFgCenterBoxSp1.style.fontSize = "13px";
		oFgCenterBoxSp1.style.color = "greenyellow";
		oFgCenterBoxInp1.style.border = "1px solid skyblue";
	} else {
		flagFgCenterBoxInp1 = false;
		oFgCenterBoxSp1.innerHTML = "您输入的格式错误，请重新输入";
		oFgCenterBoxSp1.style.fontSize = "13px";
		oFgCenterBoxSp1.style.color = "red";
		oFgCenterBoxInp1.style.border = "1px solid red";
	}
}

// 图形验证码验证
var oFgCenterBoxInp2 = document.querySelector("#fgCenterBoxInp2");
var oFgCenterBoxSp2 = document.querySelector("#fgCenterBoxSp2");
var oFgCenterBoxSp2a = document.querySelector("#fgCenterBoxSp2a");

var flagFgCenterBoxInp2 = false;
var str = "";
for (var i = 0; i < 4; i++) {
	var x = 0;
	x = Math.round(Math.random() * 35);
	if (x > 9) {
		x = String.fromCharCode(x + 55);
	}
	str += x + "";
}
oFgCenterBoxSp2.innerHTML = str;

function randomCode() {
	str = "";
	for (var i = 0; i < 4; i++) {
		var x = 0;
		x = Math.round(Math.random() * 35);
		if (x > 9) {
			x = String.fromCharCode(x + 55);
		}
		str += x + "";
	}
	oFgCenterBoxSp2.innerHTML = str;
}

oFgCenterBoxInp2.onblur = function() {
	if (oFgCenterBoxInp2.value == oFgCenterBoxSp2.innerHTML) {
		flagCenterInp2 = true;
		oFgCenterBoxSp2a.innerHTML = "验证码正确";
		oFgCenterBoxSp2a.style.color = "greenyellow";
		oFgCenterBoxSp2a.style.fontSize = "13px";
		oFgCenterBoxInp2.style.border = "1px solid skyblue";
	} else {
		flagCenterInp2 = false;
		oFgCenterBoxSp2a.innerHTML = "验证码错误，请重新输入";
		oFgCenterBoxSp2a.style.color = "red";
		oFgCenterBoxSp2a.style.fontSize = "13px";
		oFgCenterBoxInp2.style.border = "1px solid red";
	}
}

// 手机验证码发送短信
var oFgCenterBoxInp3 = document.querySelector("#fgCenterBoxInp3");
var oFgCenterBoxSp3 = document.querySelector("#fgCenterBoxSp3");
var oFgCenterBoxSp3a = document.querySelector("#fgCenterBoxSp3a");

var countTime = 60;
oFgCenterBoxInp3.onclick = function() {
	oFgCenterBoxInp3.disabled = true;
	//启动定时器
	var timeFlag = setInterval(function() {
		if (countTime > 0) {
			oFgCenterBoxSp3.innerHTML = countTime + "s";
			countTime--;
			oFgCenterBoxInp3.style.border = "1px solid skyblue";
		} else {
			clearInterval(timeFlag);
			oFgCenterBoxInp3.disabled = false;
			oFgCenterBoxSp3a.innerHTML = "请重新发送"
			oFgCenterBoxSp3a.style.fontSize = "13px";
			oFgCenterBoxSp3a.style.color = "red";
			oFgCenterBoxInp3.style.border = "1px solid red";
		}
	}, 1000);
}

var flagFgCenterBoxInp3 = false;
oFgCenterBoxInp3.onblur = function() {
	if (oFgCenterBoxInp3.value = "") {
		flagFgCenterBoxInp3 = false;
		oFgCenterBoxSp3a.innerHTML = "请输入手机验证码";
		oFgCenterBoxSp3a.style.fontSize = "13px";
		oFgCenterBoxSp3a.style.color = "red";
		oFgCenterBoxInp3.style.border = "1px solid red";
	}
}

// 账户新密码
var oFgCenterBoxInp4 = document.querySelector("#fgCenterBoxInp4");
var oFgCenterBoxSp4 = document.querySelector("#fgCenterBoxSp4");

var regNum = /\d{6,18}/;
var regChar = /[a-zA-Z]{6,18}/;
var regLetter = /[@#$]{6,18}/;

var _regNum = /^\d{6,18}$/;
var _regChar = /^[a-zA-Z]{6,18}$/;
var _regLetter = /^[@#$]{6,18}$/;
var flagFgCenterBoxInp4 = false;

oFgCenterBoxInp4.onblur = function() {
	if (oFgCenterBoxInp4.value.length < 6 || oFgCenterBoxInp4.value.length > 18 || oFgCenterBoxInp4.value == "") {
		flagFgCenterBoxInp4 = false;
		oFgCenterBoxSp4.innerHTML = "请输入6-18位密码";
		oFgCenterBoxSp4.style.color = "red";
		oFgCenterBoxInp4.style.border = "1px solid red";
		oFgCenterBoxSp4.style.fontSize = "13px";
	} else if (_regNum.test(oFgCenterBoxInp4.value) || _regChar.test(oFgCenterBoxInp4.value) || _regLetter.test(
			oFgCenterBoxInp4.value)) {
		flagFgCenterBoxInp4 = true;
		oFgCenterBoxSp4.innerHTML = "密码弱";
		oFgCenterBoxSp4.style.color = "yellow";
		oFgCenterBoxInp4.style.border = "1px solid skyblue";
		oFgCenterBoxSp4.style.fontSize = "13px";
	} else if (regNum.test(oFgCenterBoxInp4.value) && regChar.test(oFgCenterBoxInp4.value) && regLetter.test(
			oFgCenterBoxInp4.value)) {
		flagFgCenterBoxInp4 = true;
		oFgCenterBoxSp4.innerHTML = "密码强";
		oFgCenterBoxSp4.style.color = "green";
		oFgCenterBoxInp4.style.border = "1px solid skyblue";
		oFgCenterBoxSp4.style.fontSize = "13px";
	} else {
		flagFgCenterBoxInp4 = true;
		oFgCenterBoxSp4.innerHTML = "密码中";
		oFgCenterBoxSp4.style.color = "blue";
		oFgCenterBoxInp4.style.border = "1px solid skyblue";
		oFgCenterBoxSp4.style.fontSize = "13px";
	}
}

// 再次输入新密码
var oFgCenterBoxInp4 = document.querySelector("#fgCenterBoxInp4");
var oFgCenterBoxInp5 = document.querySelector("#fgCenterBoxInp5");
var oFgCenterBoxSp5 = document.querySelector("#fgCenterBoxSp5");
var flagFgCenterBoxInp5 = false;

oFgCenterBoxInp5.onblur = function() {
	if (oFgCenterBoxInp5.value == " " || oFgCenterBoxInp5.value != oFgCenterBoxInp4.value) {
		flagFgCenterBoxInp5 = false;
		oFgCenterBoxSp5.innerHTML = "输入不一致，请重新输入";
		oFgCenterBoxSp5.style.fontSize = "13px";
		oFgCenterBoxSp5.style.color = "red";
		oFgCenterBoxInp5.style.border = "1px solid red";
	} else if (oFgCenterBoxInp5.value == oFgCenterBoxInp4.value) {
		flagFgCenterBoxInp5 = true;
		oFgCenterBoxSp5.innerHTML = "输入正确";
		oFgCenterBoxSp5.style.fontSize = "13px";
		oFgCenterBoxSp5.style.color = "greenyellow";
		oFgCenterBoxInp5.style.border = "1px solid skyblue";
	}
}

//注册验证
//姓名
var oRegisterBoxInp1 = document.querySelector("#registerBoxInp1");
var oRegisterBoxSp1 = document.querySelector("#registerBoxSp1");

var regRegisterBoxInp1 = /^\D{5,9}$/;
var flagRegisterBoxInp1 = false;
oRegisterBoxInp1.onblur = function() {
	if (regRegisterBoxInp1.test(oRegisterBoxInp1.value)) {
		flagRegisterBoxInp1 = true;
		oRegisterBoxSp1.innerHTML = "格式正确";
		oRegisterBoxSp1.style.color = "greenyellow";
		oRegisterBoxSp1.style.fontSize = "13px";
		oRegisterBoxInp1.style.border = "1px solid skyblue";
	} else {
		flagRegisterBoxInp1 = false;
		oRegisterBoxSp1.innerHTML = "格式错误，请重新输入";
		oRegisterBoxSp1.style.color = "red";
		oRegisterBoxSp1.style.fontSize = "13px";
		oRegisterBoxInp1.style.border = "1px solid red";
	}
}

// 手机号验证
var oRegisterBoxInp2 = document.querySelector("#registerBoxInp2");
var oRegisterBoxSp2 = document.querySelector("#registerBoxSp2");

var regRegisterBoxInp2 = /^(15|13|18)\d{9}$/;
var flagRegisterBoxInp2 = false;
oRegisterBoxInp2.onblur = function() {
	if (regRegisterBoxInp2.test(oRegisterBoxInp2.value)) {
		flagRegisterBoxInp2 = true;
		oRegisterBoxSp2.innerHTML = "输入正确";
		oRegisterBoxSp2.style.fontSize = "13px";
		oRegisterBoxSp2.style.color = "greenyellow";
		oRegisterBoxInp2.style.border = "1px solid skyblue";
	} else {
		flagRegisterBoxInp2 = false;
		oRegisterBoxSp2.innerHTML = "您输入的格式错误，请重新输入";
		oRegisterBoxSp2.style.fontSize = "13px";
		oRegisterBoxSp2.style.color = "red";
		oRegisterBoxInp2.style.border = "1px solid red";
	}
}

// 图形验证码验证
var oRegisterBoxInp3 = document.querySelector("#registerBoxInp3");
var oRegisterBoxSp3 = document.querySelector("#registerBoxSp3");
var oRegisterBoxSp3a = document.querySelector("#registerBoxSp3a");

var flagRegisterBoxInp3 = false;
var str = "";
for (var i = 0; i < 4; i++) {
	var x = 0;
	x = Math.round(Math.random() * 35);
	if (x > 9) {
		x = String.fromCharCode(x + 55);
	}
	str += x + "";
}
oRegisterBoxSp3.innerHTML = str;

function randomCode() {
	str = "";
	for (var i = 0; i < 4; i++) {
		var x = 0;
		x = Math.round(Math.random() * 35);
		if (x > 9) {
			x = String.fromCharCode(x + 55);
		}
		str += x + "";
	}
	oRegisterBoxSp3.innerHTML = str;
}

oRegisterBoxInp3.onblur = function() {
	if (oRegisterBoxInp3.value == oRegisterBoxSp3.innerHTML) {
		flagRegisterBoxInp3 = true;
		oRegisterBoxSp3a.innerHTML = "验证码正确";
		oRegisterBoxSp3a.style.color = "greenyellow";
		oRegisterBoxSp3a.style.fontSize = "13px";
		oRegisterBoxInp3.style.border = "1px solid skyblue";
	} else {
		flagRegisterBoxInp3 = false;
		oRegisterBoxSp3a.innerHTML = "验证码错误，请重新输入";
		oRegisterBoxSp3a.style.color = "red";
		oRegisterBoxSp3a.style.fontSize = "13px";
		oRegisterBoxInp3.style.border = "1px solid red";
	}
}

// 手机验证码发送短信
var oRegisterBoxInp4 = document.querySelector("#registerBoxInp4");
var oRegisterBoxSp4 = document.querySelector("#registerBoxSp4");
var OregisterBoxSp4a = document.querySelector("#registerBoxSp4a");

var countTime = 60;
oRegisterBoxInp4.onclick = function() {
	oRegisterBoxInp4.disabled = true;
	//启动定时器
	var timeFlag = setInterval(function() {
		if (countTime > 0) {
			oRegisterBoxSp4.innerHTML = countTime + "s";
			countTime--;
			oRegisterBoxInp4.style.border = "1px solid skyblue";
		} else {
			clearInterval(timeFlag);
			oRegisterBoxInp4.disabled = false;
			OregisterBoxSp4a.innerHTML = "请重新发送"
			OregisterBoxSp4a.style.fontSize = "13px";
			OregisterBoxSp4a.style.color = "red";
			oRegisterBoxInp4.style.border = "1px solid red";
		}
	}, 1000);
}

var flagRegisterBoxInp4 = false;
oRegisterBoxInp4.onblur = function() {
	if (oRegisterBoxInp4.value = "") {
		flagRegisterBoxInp4 = false;
		OregisterBoxSp4a.innerHTML = "请输入手机验证码";
		OregisterBoxSp4a.style.fontSize = "13px";
		OregisterBoxSp4a.style.color = "red";
		oRegisterBoxInp4.style.border = "1px solid red";
	}
}

// 输入密码
var oRegisterBoxInp5 = document.querySelector("#registerBoxInp5");
var oRegisterBoxSp5 = document.querySelector("#registerBoxSp5");

var regNum = /\d{6,18}/;
var regChar = /[a-zA-Z]{6,18}/;
var regLetter = /[@#$]{6,18}/;

var _regNum = /^\d{6,18}$/;
var _regChar = /^[a-zA-Z]{6,18}$/;
var _regLetter = /^[@#$]{6,18}$/;
var flagRegisterBoxInp5 = false;

oRegisterBoxInp5.onblur = function() {
	if (oRegisterBoxInp5.value.length < 6 || oRegisterBoxInp5.value.length > 18 || oRegisterBoxInp5.value == "") {
		flagRegisterBoxInp5 = false;
		oRegisterBoxSp5.innerHTML = "请输入6-18位密码";
		oRegisterBoxSp5.style.color = "red";
		oRegisterBoxInp5.style.border = "1px solid red";
		oRegisterBoxSp5.style.fontSize = "13px";
	} else if (_regNum.test(oRegisterBoxInp5.value) || _regChar.test(oRegisterBoxInp5.value) || _regLetter.test(
			oRegisterBoxInp5.value)) {
		flagRegisterBoxInp5 = true;
		oRegisterBoxSp5.innerHTML = "密码弱";
		oRegisterBoxSp5.style.color = "yellow";
		oRegisterBoxInp5.style.border = "1px solid skyblue";
		oRegisterBoxSp5.style.fontSize = "13px";
	} else if (regNum.test(oRegisterBoxInp5.value) && regChar.test(oRegisterBoxInp5.value) && regLetter.test(
			oRegisterBoxInp5.value)) {
		flagRegisterBoxInp5 = true;
		oRegisterBoxSp5.innerHTML = "密码强";
		oRegisterBoxSp5.style.color = "greenyellow";
		oRegisterBoxInp5.style.border = "1px solid skyblue";
		oRegisterBoxSp5.style.fontSize = "13px";
	} else {
		flagRegisterBoxInp5 = true;
		oRegisterBoxSp5.innerHTML = "密码中";
		oRegisterBoxSp5.style.color = "blue";
		oRegisterBoxInp5.style.border = "1px solid skyblue";
		oRegisterBoxSp5.style.fontSize = "13px";
	}
}

// 确认密码
var oRegisterBoxInp5 = document.querySelector("#registerBoxInp5");
var oRegisterBoxInp6 = document.querySelector("#registerBoxInp6");
var oRegisterBoxSp6 = document.querySelector("#registerBoxSp6");
var flagRegisterBoxInp6 = false;

oRegisterBoxInp6.onblur = function() {
	if (oRegisterBoxInp6.value == " " || oRegisterBoxInp6.value != oRegisterBoxInp5.value) {
		flagRegisterBoxInp6 = false;
		oRegisterBoxSp6.innerHTML = "输入不一致，请重新输入";
		oRegisterBoxSp6.style.fontSize = "13px";
		oRegisterBoxSp6.style.color = "red";
		oRegisterBoxInp6.style.border = "1px solid red";
	} else if (oRegisterBoxInp6.value == oRegisterBoxInp5.value) {
		flagRegisterBoxInp6 = true;
		oRegisterBoxSp6.innerHTML = "输入正确";
		oRegisterBoxSp6.style.fontSize = "13px";
		oRegisterBoxSp6.style.color = "greenyellow";
		oRegisterBoxInp6.style.border = "1px solid skyblue";
	}
}